home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sentfactor Photo-CD Access
/
Sentfactor Photo-CD Access.iso
/
photo_cd.ms_
/
photo_cd.ms
Wrap
Text File
|
1994-06-21
|
12KB
|
471 lines
'**************************************************************************
'* MSSetup Toolkit Sample 1
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'msregdb.inc'
'$INCLUDE 'msshared.inc'
''Dialog ID's
CONST EDRIVE = 1000
CONST GDRIVE = 1300
CONST OPTIONS = 800
CONST BADG = 1600
CONST BADE = 1800
CONST ASKQUIT = 200
CONST APPHELP = 900
CONST EXITE = 2000
CONST EXITG = 2200
CONST QUITE = 2300
CONST QUITG = 2700
CONST FAILE = 2800
CONST FAILG = 3000
CONST ASKG = 3100
CONST ASKE = 600
CONST GETORGG = 7700
CONST GETORGE = 7500
CONST TOOBIGG = 5300
CONST TOOBIGE = 6300
CONST USEDG = 3300
CONST USEDE = 1900
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL OPTCUR$ ''Option selection from option dialog.
GLOBAL NAM$ ''User Name
GLOBAL FIRM$ ''Company Name
GLOBAL WINDRIVE$ ''Windows Drive Letter VFW
SrcDir$ = GetSymbolValue("STF_SRCDIR")
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowSSysDir()
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
MajorVer% = GetWindowsMajorVersion()
MinorVer% = GetWindowsMinorVersion()
IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
END IF
SetBitmap CUIDLL$, LOGO
SetTitle "Sentfactor Photo-CD Access Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "PHOTO_CD.INF"
END IF
ReadInfFile szInf$
OPTCUR$ = "1"
DEST$ = "C:\SENTFACT"
WINDRIVE$ = MID$(WinDir$, 1, 1)
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
OPTION:
SetSymbolValue "RadioDefault", OPTCUR$
OPTL1:
sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
OPTCUR$ = GetSymbolValue("ButtonChecked")
IF sz$ = "CONTINUE" THEN
UIPop(1)
IF OPTCUR$ = "1" THEN '' Deutsch
GOTO G_SIZE
ELSE
IF OPTCUR$ = "2" THEN '' English
GOTO E_SIZE
END IF
END IF
ELSE
GOSUB ASKQUIT
GOTO OPTION
END IF
G_SIZE:
WantedDiskSize&=3900000
DiskSize&=GetFreeSpaceForDrive(WINDRIVE$)
If WantedDiskSpace& > DiskSize& THEN
GOSUB TOOBIG_G
ERROR STFQUIT
EndIf
GOTO G_DRIVE
E_SIZE:
WantedDiskSize&=3900000
DiskSize&=GetFreeSpaceForDrive(WINDRIVE$)
If WantedDiskSpace& > DiskSize& THEN
GOSUB TOOBIG_E
ERROR STFQUIT
EndIf
GOTO E_DRIVE
G_DRIVE:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
G_DRIVE1:
sz$ = UIStartDlg(CUIDLL$, GDRIVE, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BAD_G
GOTO G_DRIVE1
END IF
UIPop 1
GOTO GETORG_G
ELSE
GOSUB ASK_G
GOTO G_DRIVE
END IF
E_DRIVE:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
E_DRIVE1:
sz$ = UIStartDlg(CUIDLL$, EDRIVE, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BAD_E
GOTO E_DRIVE1
END IF
UIPop 1
GOTO GETORG_E
ELSE
GOSUB ASK_E
GOTO E_DRIVE
END IF
GETORG_G:
sz$ = UIStartDlg(CUIDLL$, GETORGG, "FNameOrgDlgProc", APPHELP, HELPPROC$)
NAM$ = GetSymbolValue("NameOut")
FIRM$ = GetSymbolValue("OrgOut")
IF sz$ = "CONTINUE" THEN
IF NAM$ = "" THEN
i% = DoMsgBox("Bitte geben Sie Ihren Namen ein !", "Setup Meldung", MB_OK+MB_TASKMODAL+MB_ICONHAND)
GOTO GETORG_G
ELSEIF FIRM$ = "" THEN
i% = DoMsgBox("Bitte geben Sie Ihren Firmennamen oder Ihren persönlichen Namen ein !", "Setup Meldung", MB_OK+MB_TASKMODAL+MB_ICONHAND)
GOTO GETORG_G
END IF
UIPop 1
GOTO INSTALL_B
ELSE
GOSUB ASK_G
GOTO GETORG_G
END IF
GETORG_E:
sz$ = UIStartDlg(CUIDLL$, GETORGE, "FNameOrgDlgProc", APPHELP, HELPPROC$)
NAM$ = GetSymbolValue("NameOut")
FIRM$ = GetSymbolValue("OrgOut")
IF sz$ = "CONTINUE" THEN
IF NAM$ = "" THEN
i% = DoMsgBox("Please fill in your full name.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
GOTO GETORG_E
ELSEIF FIRM$ = "" THEN
i% = DoMsgBox("Please fill in either your company name or your last name", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
GOTO GETORG_E
END IF
UIPop 1
GOTO INSTALL_B
ELSE
GOSUB ASK_E
GOTO GETORG_E
ENDIF
INSTALL_B:
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF OPTCUR$ = "1" THEN
dlg% = EXITG
ELSE
IF OPTCUR$ = "2" THEN
dlg% = EXITE
END IF
END IF
ELSEIF ERR = STFQUIT THEN
IF OPTCUR$ = "1" THEN
dlg% = QUITG
ELSE
IF OPTCUR$ = "2" THEN
dlg% = QUITE
END IF
END IF
ELSE
IF OPTCUR$ = "1" THEN
dlg% = FAILG
ELSE
IF OPTCUR$ = "2" THEN
dlg% = FAILE
END IF
END IF
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
IF OPTCUR$ = "1" THEN
i% = DoMsgBox("Setup Quelle defekt, bitte nehmen Sie mit Sentfactor Limited Kontakt auf.", "Setup Meldung", MB_OK+MB_TASKMODAL+MB_ICONHAND)
ELSE
IF OPTCUR$ = "2" THEN
i% = DoMsgBox("Setup sources were corrupted, please contact Sentfactor Limited.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END IF
END IF
END
BAD_G:
sz$ = UIStartDlg(CUIDLL$, BADG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BAD_G
END IF
UIPop 1
RETURN
BAD_E:
sz$ = UIStartDlg(CUIDLL$, BADE, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BAD_E
END IF
UIPop 1
RETURN
TOOBIG_G:
SZ$ = UIStartDlg(CUIDLL$, TOOBIGG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG_G
END IF
UIPop 1
RETURN
TOOBIG_E:
SZ$ = UIStartDlg(CUIDLL$, TOOBIGE, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG_E
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
ASK_G:
sz$ = UIStartDlg(CUIDLL$, ASKG, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASK_G
ELSE
UIPop 1
END IF
RETURN
ASK_E:
sz$ = UIStartDlg(CUIDLL$, ASKE, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASK_E
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowSSysDir()
CreateDir DEST$, cmoNone
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile " User chose option: '" + OPTCUR$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
WriteToLogFile " STF_SRCDIR " + SrcDir$ + WinDir$
WriteToLogFile ""
AddSectionFilesToCopyList "Common", SrcDir$, DEST$
IF OPTCUR$ = "1" THEN
AddSectionKeyFileToCopyList "Options", OPTCUR$, SrcDir$, DEST$
ELSE
AddSectionKeyFileToCopyList "Options", OPTCUR$, SrcDir$, DEST$
ENDIF
CopyFilesInCopyList
''Updating WIN.INI and SYSTEM.INI
CreateIniKeyValue WinDir$ + "WIN.INI", "windows", "firm", firm$, cmoOverwrite
CreateIniKeyValue WinDir$ + "WIN.INI", "windows", "username", nam$, cmoOverwrite
CreateIniKeyValue DEST$ + "\SENTFACT.INI", "userdata", "firm", firm$, cmoOverwrite
CreateIniKeyValue DEST$ + "\SENTFACT.INI", "userdata", "username", nam$, cmoOverwrite
CreateProgmanGroup "Sentfactor", "", cmoNone
ShowProgmanGroup "Sentfactor", 1, cmoNone
CreateProgmanItem "Sentfactor", "Sentfactor Photo-CD Access", MakePath(DEST$,"photo_cd.exe"), "", cmoOverwrite
CloseLogFile
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION